<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

return new class extends Migration
{
    /**
     * Run the migrations.
     */
    public function up(): void
    {
        Schema::create('orders', function (Blueprint $table) {
            $table->id();
            $table->integer('user_id')->comment('下单ID');
            $table->string('order_no')->unique()->comment('订单单号');
            $table->integer('amount')->comment('总金额 单位分');
            $table->tinyInteger('status')->default(0)->comment('订单状态  1下单 2支付 3发货 4收货');
            $table->tinyInteger('address_id')->comment('收获地址');
            $table->string('express_type')->comment('快递类型:SF YT YD');
            $table->String('express_no')->comment('快递单号');
            $table->timestamp('pay_time')->nullable()->comment('支付时间');
            $table->String('pay_type')->nullable()->comment('支付类型:ALIPAY WECHAT');
            $table->String('trade_no')->nullable()->comment('支付单号');
            $table->timestamps();
        });
    }
    public function down(): void
    {
        Schema::dropIfExists('orders');
    }
};
